<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
 <meta>
  <!-- Stylesheets -->
  <link href="../web.css" type="text/css" rel="stylesheet"></link>
  <link href="../pygmentize.css" type="text/css" rel="stylesheet"></link>
  <title>VLFeat - Documentation - C API</title>
  <link rel="stylesheet" type="text/css" href="../doxygen.css"></style>

  <!-- Scripts-->
  
 </meta>

 <!-- Body Start -->
 <body>
  <div id="header">
   <!-- Google CSE Search Box Begins -->
   <form action="http://www.vlfeat.org/search.html" method="get" id="cse-search-box" enctype="application/x-www-form-urlencoded">
    <div>
     <input type="hidden" name="cx" value="003215582122030917471:oq23albfeam"></input>
     <input type="hidden" name="cof" value="FORID:11"></input>
     <input type="hidden" name="ie" value="UTF-8"></input>
     <input type="text" name="q" size="31"></input>
     <input type="submit" name="sa" value="Search"></input>
    </div>
   </form>
   <script src="http://www.google.com/coop/cse/brand?form=cse-search-box&amp;lang=en" xml:space="preserve" type="text/javascript"></script>
   <!-- Google CSE Search Box Ends -->
   <h1><a shape="rect" href="../index.html" class="plain"><span id="vlfeat">VLFeat</span><span id="dotorg">.org</span></a></h1>
  </div>
  <div id="headbanner">
   Documentation - C API
  </div>
  <div id="pagebody">
   <div id="sidebar"> <!-- Navigation Start -->
    <ul>
<li><a href="../index.html">Home</a>
</li>
<li><a href="../download.html">Download</a>
</li>
<li><a href="../doc.html">Documentation</a>
<ul>
<li><a href="../mdoc/mdoc.html">Matlab API</a>
</li>
<li><a href="index.html" class='active' >C API</a>
</li>
<li><a href="../man/man.html">Man pages</a>
</li>
</ul></li>
<li><a href="../overview/tut.html">Tutorials</a>
</li>
<li><a href="../applications/apps.html">Applications</a>
</li>
</ul>

   </div> <!-- sidebar -->
   <div id="content">
    
    <link rel="stylesheet" type="text/css" href="../doxygen.css"></style>
    <div class="doxygen">
<div>
<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#enum-members">Enumerations</a>  </div>
  <div class="headertitle">
<div class="title">ikmeans.h File Reference</div>  </div>
</div>
<div class="contents">

<p>Integer K-Means clustering.  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &quot;<a class="el" href="generic_8h.html">generic.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="random_8h.html">random.h</a>&quot;</code><br/>
</div><table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structVlIKMFilt.html">VlIKMFilt</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">IKM quantizer.  <a href="structVlIKMFilt.html#details">More...</a><br/></td></tr>
<tr><td colspan="2"><h2><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">typedef <a class="el" href="host_8h.html#a03fa435c713d3141c4a700f79f5b2600">vl_int32</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ikmeans_8h.html#a205ce6418452915b7ac046e10db82a50">vl_ikm_acc</a></td></tr>
<tr><td colspan="2"><h2><a name="enum-members"></a>
Enumerations</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ikmeans_8h.html#a4aa95067e495fa8309ab028307a3418d">VlIKMAlgorithms</a> { <a class="el" href="ikmeans_8h.html#a4aa95067e495fa8309ab028307a3418da03abd693c3d932bb543401274eb868c4">VL_IKM_LLOYD</a>, 
<a class="el" href="ikmeans_8h.html#a4aa95067e495fa8309ab028307a3418da46d6e04c3599a881c16722b6969c5a21">VL_IKM_ELKAN</a>
 }</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">IKM algorithms.  <a href="ikmeans_8h.html#a4aa95067e495fa8309ab028307a3418d">More...</a><br/></td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td colspan="2"><div class="groupHeader">Create and destroy</div></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ikmeans_8h.html#af5a42441a336dd73c39c5a1ec8028444">vl_ikm_new</a> (int method)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a new IKM quantizer.  <a href="#af5a42441a336dd73c39c5a1ec8028444"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ikmeans_8h.html#a33a659152e03286d390aa17b1a212a7b">vl_ikm_delete</a> (<a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> *f)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Delete IKM quantizer.  <a href="#a33a659152e03286d390aa17b1a212a7b"></a><br/></td></tr>
<tr><td colspan="2"><div class="groupHeader">Process data</div></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ikmeans_8h.html#a8b81cf293fe68ffbe9c65f98fa875b44">vl_ikm_init</a> (<a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> *f, <a class="el" href="ikmeans_8h.html#a205ce6418452915b7ac046e10db82a50">vl_ikm_acc</a> const *centers, int M, int K)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize quantizer with centers.  <a href="#a8b81cf293fe68ffbe9c65f98fa875b44"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ikmeans_8h.html#ae187be70645b7a7336b081a5bec302b1">vl_ikm_init_rand</a> (<a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> *f, int M, int K)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize quantizer with random centers.  <a href="#ae187be70645b7a7336b081a5bec302b1"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ikmeans_8h.html#ac6d501aa8f467292655baba3c8fa0632">vl_ikm_init_rand_data</a> (<a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> *f, <a class="el" href="host_8h.html#a38fbd9a3cf53dfc9a5650c38497b7d35">vl_uint8</a> const *data, int M, int N, int K)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize with centers from random data.  <a href="#ac6d501aa8f467292655baba3c8fa0632"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ikmeans_8h.html#a1a984dc606d95bb398224b1bb7a523bf">vl_ikm_train</a> (<a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> *f, <a class="el" href="host_8h.html#a38fbd9a3cf53dfc9a5650c38497b7d35">vl_uint8</a> const *data, int N)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Train clusters.  <a href="#a1a984dc606d95bb398224b1bb7a523bf"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ikmeans_8h.html#a14aa91465a947dc1dfdfc35fea5bc3ca">vl_ikm_push</a> (<a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> *f, <a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a> *asgn, <a class="el" href="host_8h.html#a38fbd9a3cf53dfc9a5650c38497b7d35">vl_uint8</a> const *data, int N)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Project data to clusters.  <a href="#a14aa91465a947dc1dfdfc35fea5bc3ca"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ikmeans_8h.html#a151e7935e7da5e3af0c686bff940ad10">vl_ikm_push_one</a> (<a class="el" href="ikmeans_8h.html#a205ce6418452915b7ac046e10db82a50">vl_ikm_acc</a> const *centers, <a class="el" href="host_8h.html#a38fbd9a3cf53dfc9a5650c38497b7d35">vl_uint8</a> const *data, int M, int K)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Project one datum to clusters.  <a href="#a151e7935e7da5e3af0c686bff940ad10"></a><br/></td></tr>
<tr><td colspan="2"><div class="groupHeader">Retrieve data and parameters</div></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ikmeans_8h.html#a75ab6a7a2c6de711ffaed775ed283ccb">vl_ikm_get_ndims</a> (<a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> const *f)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Get data dimensionality.  <a href="#a75ab6a7a2c6de711ffaed775ed283ccb"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ikmeans_8h.html#a794472ef0f4a362e5f4953d729c638a4">vl_ikm_get_K</a> (<a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> const *f)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the number of centers K.  <a href="#a794472ef0f4a362e5f4953d729c638a4"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ikmeans_8h.html#afe77d60b7c64f773b9e5edbcebca6e21">vl_ikm_get_verbosity</a> (<a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> const *f)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Get verbosity level.  <a href="#afe77d60b7c64f773b9e5edbcebca6e21"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ikmeans_8h.html#a2a26138217a2144e4f4ece7c44fe5e14">vl_ikm_get_max_niters</a> (<a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> const *f)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Get maximum number of iterations.  <a href="#a2a26138217a2144e4f4ece7c44fe5e14"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="ikmeans_8h.html#a205ce6418452915b7ac046e10db82a50">vl_ikm_acc</a> const *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ikmeans_8h.html#a585c9f15e530c1fa45b51a06e2c0c58e">vl_ikm_get_centers</a> (<a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> const *f)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Get maximum number of iterations.  <a href="#a585c9f15e530c1fa45b51a06e2c0c58e"></a><br/></td></tr>
<tr><td colspan="2"><div class="groupHeader">Set parameters</div></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ikmeans_8h.html#adbf9d13d091a5bec378023de11bfa690">vl_ikm_set_verbosity</a> (<a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> *f, int verb)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Set verbosity level.  <a href="#adbf9d13d091a5bec378023de11bfa690"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ikmeans_8h.html#a6196de7ceceab4e8c21daf2db1cd9e34">vl_ikm_set_max_niters</a> (<a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> *f, int max_niters)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Set maximum number of iterations.  <a href="#a6196de7ceceab4e8c21daf2db1cd9e34"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Integer K-means (IKM) is an implementation of K-means clustering (or Vector Quantization, VQ) for integer data. This is particularly useful for clustering large collections of visual descriptors.</p>
<p>Use the function <a class="el" href="ikmeans_8c.html#af5a42441a336dd73c39c5a1ec8028444" title="Create a new IKM quantizer.">vl_ikm_new()</a> to create a IKM quantizer. Initialize the IKM quantizer with <code>K</code> clusters by <a class="el" href="ikmeans_8h.html#a8b81cf293fe68ffbe9c65f98fa875b44" title="Initialize quantizer with centers.">vl_ikm_init()</a> or similar function. Use <a class="el" href="ikmeans_8c.html#a1a984dc606d95bb398224b1bb7a523bf" title="Train clusters.">vl_ikm_train()</a> to train the quantizer. Use <a class="el" href="ikmeans_8c.html#a14aa91465a947dc1dfdfc35fea5bc3ca" title="Project data to clusters.">vl_ikm_push()</a> or <a class="el" href="ikmeans_8c.html#a151e7935e7da5e3af0c686bff940ad10" title="Project one datum to clusters.">vl_ikm_push_one()</a> to quantize new data.</p>
<p>Given data <img class="formulaInl" alt="$x_1,\dots,x_N\in R^d$" src="form_96.png"/> and a number of clusters <img class="formulaInl" alt="$K$" src="form_97.png"/>, the goal is to find assignments <img class="formulaInl" alt="$a_i\in\{1,\dots,K\},$" src="form_98.png"/> and centers <img class="formulaInl" alt="$c_1,\dots,c_K\in R^d$" src="form_99.png"/> so that the <em>expected distortion</em></p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ E(\{a_{i}, c_j\}) = \frac{1}{N} \sum_{i=1}^N d(x_i, c_{a_i}) \]" src="form_100.png"/>
</p>
<p>is minimized. Here <img class="formulaInl" alt="$d(x_i, c_{a_i})$" src="form_101.png"/> is the <em>distortion</em>, i.e. the cost we pay for representing <img class="formulaInl" alt="$ x_i $" src="form_102.png"/> by <img class="formulaInl" alt="$ c_{a_i} $" src="form_103.png"/>. IKM uses the squared distortion <img class="formulaInl" alt="$d(x,y)=\|x-y\|^2_2$" src="form_104.png"/>.</p>
<h2><a class="anchor" id="ikmeans-algo"></a>
Algorithms</h2>
<h3><a class="anchor" id="ikmeans-alg-init"></a>
Initialization</h3>
<p>Most K-means algorithms are iterative and needs an initialization in the form of an initial choice of the centers <img class="formulaInl" alt="$c_1,\dots,c_K$" src="form_105.png"/>. We include the following options:</p>
<ul>
<li>User specified centers (<a class="el" href="ikmeans__init_8tc.html#a8b81cf293fe68ffbe9c65f98fa875b44" title="Initialize quantizer with centers.">vl_ikm_init</a>);</li>
<li>Random centers (<a class="el" href="ikmeans__init_8tc.html#ae187be70645b7a7336b081a5bec302b1" title="Initialize quantizer with random centers.">vl_ikm_init_rand</a>);</li>
<li>Centers from <code>K</code> randomly selected data points (<a class="el" href="ikmeans__init_8tc.html#ac6d501aa8f467292655baba3c8fa0632" title="Initialize with centers from random data.">vl_ikm_init_rand_data</a>).</li>
</ul>
<h3><a class="anchor" id="ikmeans-alg-lloyd"></a>
Lloyd</h3>
<p>The Lloyd (also known as Lloyd-Max and LBG) algorithm iteratively:</p>
<ul>
<li>Fixes the centers, optimizing the assignments (minimizing by exhaustive search the association of each data point to the centers);</li>
<li>Fixes the assignments and optimizes the centers (by descending the distortion error function). For the squared distortion, this step is in closed form.</li>
</ul>
<p>This algorithm is not particularly efficient because all data points need to be compared to all centers, for a complexity <img class="formulaInl" alt="$O(dNKT)$" src="form_106.png"/>, where <em>T</em> is the total number of iterations.</p>
<h3><a class="anchor" id="ikmeans-alg-elkan"></a>
Elkan</h3>
<p>The Elkan algorithm is an optimized variant of Lloyd. By making use of the triangle inequality, many comparisons of data points and centers are avoided, especially at later iterations. Usually 4-5 times less comparisons than Lloyd are preformed, providing a dramatic speedup in the execution time.</p>
<dl class="author"><dt><b>Author:</b></dt><dd>Brian Fulkerson </dd>
<dd>
Andrea Vedaldi </dd></dl>
</div><hr/><h2>Typedef Documentation</h2>
<a class="anchor" id="a205ce6418452915b7ac046e10db82a50"></a><!-- doxytag: member="ikmeans.h::vl_ikm_acc" ref="a205ce6418452915b7ac046e10db82a50" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef <a class="el" href="host_8h.html#a03fa435c713d3141c4a700f79f5b2600">vl_int32</a> <a class="el" href="ikmeans_8h.html#a205ce6418452915b7ac046e10db82a50">vl_ikm_acc</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>IKM accumulator data type </p>

</div>
</div>
<hr/><h2>Enumeration Type Documentation</h2>
<a class="anchor" id="a4aa95067e495fa8309ab028307a3418d"></a><!-- doxytag: member="ikmeans.h::VlIKMAlgorithms" ref="a4aa95067e495fa8309ab028307a3418d" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="ikmeans_8h.html#a4aa95067e495fa8309ab028307a3418d">VlIKMAlgorithms</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" id="a4aa95067e495fa8309ab028307a3418da03abd693c3d932bb543401274eb868c4"></a><!-- doxytag: member="VL_IKM_LLOYD" ref="a4aa95067e495fa8309ab028307a3418da03abd693c3d932bb543401274eb868c4" args="" -->VL_IKM_LLOYD</em>&nbsp;</td><td>
<p>Lloyd algorithm </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a4aa95067e495fa8309ab028307a3418da46d6e04c3599a881c16722b6969c5a21"></a><!-- doxytag: member="VL_IKM_ELKAN" ref="a4aa95067e495fa8309ab028307a3418da46d6e04c3599a881c16722b6969c5a21" args="" -->VL_IKM_ELKAN</em>&nbsp;</td><td>
<p>Elkan algorithm </p>
</td></tr>
</table>
</dd>
</dl>

</div>
</div>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="a33a659152e03286d390aa17b1a212a7b"></a><!-- doxytag: member="ikmeans.h::vl_ikm_delete" ref="a33a659152e03286d390aa17b1a212a7b" args="(VlIKMFilt *f)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void vl_ikm_delete </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> *&#160;</td>
          <td class="paramname"><em>f</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">f</td><td>IKM quantizer. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a585c9f15e530c1fa45b51a06e2c0c58e"></a><!-- doxytag: member="ikmeans.h::vl_ikm_get_centers" ref="a585c9f15e530c1fa45b51a06e2c0c58e" args="(VlIKMFilt const *f)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="ikmeans_8h.html#a205ce6418452915b7ac046e10db82a50">vl_ikm_acc</a> const * vl_ikm_get_centers </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> const *&#160;</td>
          <td class="paramname"><em>f</em></td><td>)</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">f</td><td>IKM filter. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>maximum number of iterations. </dd></dl>

</div>
</div>
<a class="anchor" id="a794472ef0f4a362e5f4953d729c638a4"></a><!-- doxytag: member="ikmeans.h::vl_ikm_get_K" ref="a794472ef0f4a362e5f4953d729c638a4" args="(VlIKMFilt const *f)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int vl_ikm_get_K </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> const *&#160;</td>
          <td class="paramname"><em>f</em></td><td>)</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">f</td><td>IKM filter. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>number of centers K. </dd></dl>

</div>
</div>
<a class="anchor" id="a2a26138217a2144e4f4ece7c44fe5e14"></a><!-- doxytag: member="ikmeans.h::vl_ikm_get_max_niters" ref="a2a26138217a2144e4f4ece7c44fe5e14" args="(VlIKMFilt const *f)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int vl_ikm_get_max_niters </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> const *&#160;</td>
          <td class="paramname"><em>f</em></td><td>)</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">f</td><td>IKM filter. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>maximum number of iterations. </dd></dl>

</div>
</div>
<a class="anchor" id="a75ab6a7a2c6de711ffaed775ed283ccb"></a><!-- doxytag: member="ikmeans.h::vl_ikm_get_ndims" ref="a75ab6a7a2c6de711ffaed775ed283ccb" args="(VlIKMFilt const *f)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int vl_ikm_get_ndims </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> const *&#160;</td>
          <td class="paramname"><em>f</em></td><td>)</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">f</td><td>IKM filter. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>data dimensionality. </dd></dl>

</div>
</div>
<a class="anchor" id="afe77d60b7c64f773b9e5edbcebca6e21"></a><!-- doxytag: member="ikmeans.h::vl_ikm_get_verbosity" ref="afe77d60b7c64f773b9e5edbcebca6e21" args="(VlIKMFilt const *f)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int vl_ikm_get_verbosity </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> const *&#160;</td>
          <td class="paramname"><em>f</em></td><td>)</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">f</td><td>IKM filter. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>verbosity level. </dd></dl>

</div>
</div>
<a class="anchor" id="a8b81cf293fe68ffbe9c65f98fa875b44"></a><!-- doxytag: member="ikmeans.h::vl_ikm_init" ref="a8b81cf293fe68ffbe9c65f98fa875b44" args="(VlIKMFilt *f, vl_ikm_acc const *centers, int M, int K)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void vl_ikm_init </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> *&#160;</td>
          <td class="paramname"><em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="ikmeans_8h.html#a205ce6418452915b7ac046e10db82a50">vl_ikm_acc</a> const *&#160;</td>
          <td class="paramname"><em>centers</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>M</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>K</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">f</td><td>IKM quantizer. </td></tr>
    <tr><td class="paramname">centers</td><td>centers. </td></tr>
    <tr><td class="paramname">M</td><td>data dimensionality. </td></tr>
    <tr><td class="paramname">K</td><td>number of clusters. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ae187be70645b7a7336b081a5bec302b1"></a><!-- doxytag: member="ikmeans.h::vl_ikm_init_rand" ref="ae187be70645b7a7336b081a5bec302b1" args="(VlIKMFilt *f, int M, int K)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void vl_ikm_init_rand </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> *&#160;</td>
          <td class="paramname"><em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>M</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>K</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">f</td><td>IKM quantizer. </td></tr>
    <tr><td class="paramname">M</td><td>data dimensionality. </td></tr>
    <tr><td class="paramname">K</td><td>number of clusters. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ac6d501aa8f467292655baba3c8fa0632"></a><!-- doxytag: member="ikmeans.h::vl_ikm_init_rand_data" ref="ac6d501aa8f467292655baba3c8fa0632" args="(VlIKMFilt *f, vl_uint8 const *data, int M, int N, int K)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void vl_ikm_init_rand_data </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> *&#160;</td>
          <td class="paramname"><em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a38fbd9a3cf53dfc9a5650c38497b7d35">vl_uint8</a> const *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>M</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>N</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>K</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">f</td><td>IKM quantizer. </td></tr>
    <tr><td class="paramname">data</td><td>data. </td></tr>
    <tr><td class="paramname">M</td><td>data dimensionality. </td></tr>
    <tr><td class="paramname">N</td><td>number of data. </td></tr>
    <tr><td class="paramname">K</td><td>number of clusters. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="af5a42441a336dd73c39c5a1ec8028444"></a><!-- doxytag: member="ikmeans.h::vl_ikm_new" ref="af5a42441a336dd73c39c5a1ec8028444" args="(int method)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structVlIKMFilt.html">VlIKMFilt</a>* vl_ikm_new </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>method</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">method</td><td>Clustering algorithm.</td></tr>
  </table>
  </dd>
</dl>
<p>The function allocates initializes a new IKM quantizer to operate based algorithm <em>method</em>.</p>
<p><em>method</em> has values in the enumerations <a class="el" href="ikmeans_8h.html#a4aa95067e495fa8309ab028307a3418d" title="IKM algorithms.">VlIKMAlgorithms</a>.</p>
<dl class="return"><dt><b>Returns:</b></dt><dd>new IKM quantizer. </dd></dl>

</div>
</div>
<a class="anchor" id="a14aa91465a947dc1dfdfc35fea5bc3ca"></a><!-- doxytag: member="ikmeans.h::vl_ikm_push" ref="a14aa91465a947dc1dfdfc35fea5bc3ca" args="(VlIKMFilt *f, vl_uint *asgn, vl_uint8 const *data, int N)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void vl_ikm_push </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> *&#160;</td>
          <td class="paramname"><em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a> *&#160;</td>
          <td class="paramname"><em>asgn</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a38fbd9a3cf53dfc9a5650c38497b7d35">vl_uint8</a> const *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>N</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">f</td><td>IKM quantizer. </td></tr>
    <tr><td class="paramname">asgn</td><td>Assignments (out). </td></tr>
    <tr><td class="paramname">data</td><td>data. </td></tr>
    <tr><td class="paramname">N</td><td>number of data (<em>N</em> <code>&gt;=</code> 1).</td></tr>
  </table>
  </dd>
</dl>
<p>The function projects the data <em>data</em> on the integer K-means clusters specified by the IKM quantizer <em>f</em>. Notice that the quantizer must be initialized. </p>

</div>
</div>
<a class="anchor" id="a151e7935e7da5e3af0c686bff940ad10"></a><!-- doxytag: member="ikmeans.h::vl_ikm_push_one" ref="a151e7935e7da5e3af0c686bff940ad10" args="(vl_ikm_acc const *centers, vl_uint8 const *data, int M, int K)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a> vl_ikm_push_one </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="ikmeans_8h.html#a205ce6418452915b7ac046e10db82a50">vl_ikm_acc</a> const *&#160;</td>
          <td class="paramname"><em>centers</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a38fbd9a3cf53dfc9a5650c38497b7d35">vl_uint8</a> const *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>M</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>K</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">centers</td><td>centers. </td></tr>
    <tr><td class="paramname">data</td><td>datum to project. </td></tr>
    <tr><td class="paramname">K</td><td>number of centers. </td></tr>
    <tr><td class="paramname">M</td><td>dimensionality of the datum.</td></tr>
  </table>
  </dd>
</dl>
<p>The function projects the specified datum <em>data</em> on the clusters specified by the centers <em>centers</em>.</p>
<dl class="return"><dt><b>Returns:</b></dt><dd>the cluster index. </dd></dl>

</div>
</div>
<a class="anchor" id="a6196de7ceceab4e8c21daf2db1cd9e34"></a><!-- doxytag: member="ikmeans.h::vl_ikm_set_max_niters" ref="a6196de7ceceab4e8c21daf2db1cd9e34" args="(VlIKMFilt *f, int max_niters)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void vl_ikm_set_max_niters </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> *&#160;</td>
          <td class="paramname"><em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>max_niters</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">f</td><td>IKM filter. </td></tr>
    <tr><td class="paramname">max_niters</td><td>maximum number of iterations. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="adbf9d13d091a5bec378023de11bfa690"></a><!-- doxytag: member="ikmeans.h::vl_ikm_set_verbosity" ref="adbf9d13d091a5bec378023de11bfa690" args="(VlIKMFilt *f, int verb)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void vl_ikm_set_verbosity </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> *&#160;</td>
          <td class="paramname"><em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>verb</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">f</td><td>IKM filter. </td></tr>
    <tr><td class="paramname">verb</td><td>verbosity level. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a1a984dc606d95bb398224b1bb7a523bf"></a><!-- doxytag: member="ikmeans.h::vl_ikm_train" ref="a1a984dc606d95bb398224b1bb7a523bf" args="(VlIKMFilt *f, vl_uint8 const *data, int N)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int vl_ikm_train </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlIKMFilt.html">VlIKMFilt</a> *&#160;</td>
          <td class="paramname"><em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a38fbd9a3cf53dfc9a5650c38497b7d35">vl_uint8</a> const *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>N</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">f</td><td>IKM quantizer. </td></tr>
    <tr><td class="paramname">data</td><td>data. </td></tr>
    <tr><td class="paramname">N</td><td>number of data (<em>N</em> <code>&gt;=</code> 1).</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>-1 if an overflow may have occurred. </dd></dl>

</div>
</div>
</div>
     <!-- Doc Here -->
    </div>
   
   </div>
   <div class="clear">&nbsp;</div>
  </div> <!-- pagebody -->
  <div id="footer">
   &copy; 2007-12 Andrea Vedaldi and Brian Fulkerson
  </div> <!-- footer -->

  <!-- Google Analytics Begins -->
  <script xml:space="preserve" type="text/javascript">
   //<![CDATA[
    var localre = /vlfeat.org/;
    if(document.location.host.search(localre) != -1)
    {
   var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
   document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
   }
   //]]>
  </script>
  <script xml:space="preserve" type="text/javascript">
    //<![CDATA[
    var localre = /vlfeat.org/;
    if(document.location.host.search(localre) != -1)
    {

   try {
   var pageTracker = _gat._getTracker("UA-4936091-2");
   pageTracker._trackPageview();
   } catch(err) {}

   }
   //]]>
  </script>
  <!-- Google Analytics Ends -->
 </body>
</html>

 
